cmake_minimum_required( VERSION 3.0.0 )
project( RtspRecordHLS VERSION 0.1.0 )

# 设置输出根目录
SET(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/install)

# SET(DESTINATION ${PROJECT_SOURCE_DIR}/install)
message(STATUS "=======================================")
message(STATUS "路径设置")
message(STATUS "---------------------------------------")
message(STATUS "PROJECT_BINARY_DIR:${PROJECT_BINARY_DIR}")
message(STATUS "PROJECT_SOURCE_DIR:${PROJECT_SOURCE_DIR}")
message(STATUS "CMAKE_INSTALL_PREFIX:${CMAKE_INSTALL_PREFIX}")
# message(STATUS "DESTINATION:${DESTINATION}")
message(STATUS "---------------------------------------")


set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -g")
set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-stack-check")

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-stack-check")


add_definitions(
    -DTIXML_USE_STL
)

# 库头文件头文件路径
include_directories(
    # "/Users/liuyuelong/Workspace/LibsGit/BuisBuild.git/ffmpeg/buildForMac/dist20200920105536/include"
    "/opt/data/sip/ffmpeg_lib/include"
    # "/opt/data/sip/jrtp/jrtplib_debug/include"
    # "/opt/data/sip/yaml-cpp/include"
    # "/opt/data/log/zlog-1.2.14/src"
)

# 源码库头文件路径
include_directories(
    # "./libs/libpsmux/inc/"
    "./libs/stl_utils/src/"
    # "./libs/stl_utils/libs/jsoncpp/json/"
    # "./libs/stl_utils/libs/tinyxml/"
)

# 源码头文件路径
include_directories(
    "./src/HLSRecord"
    "./src/FFmpegRtspClient"
)

message(STATUS "=======================================")
message(STATUS "头文件搜索路径")
message(STATUS "---------------------------------------")
foreach(src_filename ${INCLUDE_DIRECTORIES})
    message(STATUS ${src_filename})
endforeach(src_filename)
message(STATUS "---------------------------------------")

# ffmpeg库路径
link_directories(
    "/opt/data/sip/ffmpeg_lib/lib"
    # "/Users/liuyuelong/Workspace/LibsGit/BuisBuild.git/ffmpeg/buildForMac/dist20200920105536/lib"
)

# yaml-cpp库路径
# link_directories(
#     "/opt/data/sip/yaml-cpp/build"
# )

# jrtp库路径
# link_directories(
#     # "/opt/data/sip/jrtp/jrtplib_debug/lib"
#     "/opt/data/sip/jrtp/jrtplib-3.11.1_org_no_thread/src"
# )

# exosip库路径
# link_directories(
#     "/opt/data/sip/exosip/libosip2-5.0.0/src/osipparser2/.libs"
#     "/opt/data/sip/exosip/libosip2-5.0.0/src/osip2/.libs"
#     "/opt/data/sip/exosip/libexosip2-5.0.0/src/.libs"
# )

# eXosip库路径
# link_directories(
#     # "/opt/data/sip/jrtp/jrtplib_debug/lib"
#     "/opt/data/sip/jrtp/jrtplib-3.11.1_org_no_thread/src"
# )

# zlog库路径
# link_directories(
#     "/opt/data/log/zlog-1.2.14/src"
# )


message(STATUS "=======================================")
message(STATUS "库搜索路径")
message(STATUS "---------------------------------------")
foreach(src_filename ${LINK_DIRECTORIES})
    message(STATUS ${src_filename})
endforeach(src_filename)
message(STATUS "---------------------------------------")


# 源码
aux_source_directory(./src SRC_LIST)
aux_source_directory(./src/HLSRecord SRC_LIST)
aux_source_directory(./src/FFmpegRtspClient SRC_LIST)
# aux_source_directory(./src/GBSMS SRC_LIST)
# aux_source_directory(./src/GBClient SRC_LIST)
# aux_source_directory(./src/manscdp SRC_LIST)
# aux_source_directory(./src/GBSvrManager SRC_LIST)
# aux_source_directory(./src/PsMuxer SRC_LIST)
# aux_source_directory(./src/RtpSender SRC_LIST)
# aux_source_directory(./src/RtspClient SRC_LIST)
# aux_source_directory(./src/tools SRC_LIST)

# 源码库
# aux_source_directory(./libs/libpsmux/src SRC_LIST)
aux_source_directory(./libs/stl_utils/src/STL_Path SRC_LIST)
aux_source_directory(./libs/stl_utils/src/STL_Timestamp SRC_LIST)
aux_source_directory(./libs/stl_utils/src/STL_FS SRC_LIST)
# aux_source_directory(./libs/stl_utils/src/STL_YAML SRC_LIST)
# aux_source_directory(./libs/stl_utils/src/STL_XML SRC_LIST)
# aux_source_directory(.libs/stl_utils/libs/jsoncpp SRC_LIST)
# aux_source_directory(./libs/stl_utils/libs/tinyxml SRC_LIST)


message(STATUS "=======================================")
message(STATUS "项目源文件列表")
message(STATUS "---------------------------------------")
foreach(src_filename ${SRC_LIST})
    message(STATUS ${src_filename})
endforeach(src_filename)
message(STATUS "---------------------------------------")

add_executable( ${PROJECT_NAME} ${SRC_LIST} )

target_link_libraries(
    ${PROJECT_NAME} 
    -lavformat
    -lavcodec
    -lavutil
)

# target_link_libraries(
#     ${PROJECT_NAME} 
#     -ljrtp
# )

# target_link_libraries(
#     ${PROJECT_NAME} 
#     -lyaml-cpp
# )

target_link_libraries(
    ${PROJECT_NAME}
    -lpthread
)

# target_link_libraries(
#     ${PROJECT_NAME}
#     -losip2
#     -losipparser2
#     -leXosip2
# )

# target_link_libraries(
#     ${PROJECT_NAME}
#     -lzlog
# )


# make时的可执行文件输出路径
# set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/output)


# make install时的可执行文件输出路径（相对于CMAKE_INSTALL_PREFIX的目录）
# install(TARGETS ${PROJECT_NAME} DESTINATION bin)
install(TARGETS ${PROJECT_NAME} DESTINATION .) 

